<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 作业1，函数封装让用户输入5个数，排序好，返回出来  例如 [20 ,30, 40, 50 ,60]
    function fn() {
      let arr = []
      for (let i = 1; i <= 5; i++) {
        let num = +prompt(`请输入第${i}个数`)
        // console.log(num);
        arr.push(num)
      }
      const res = arr.sort(function (a, b) {
        return (a - b)
      })
      return res
    }
    fn()
  </script>
</body>

</html>